<template>
  <div class="box">
    <!-- 搜索组件 -->
    <Search v v-show="Searchval" />
    <i class="iconfont editicon" v-show="Editval">&#xe617;</i>
    <span class="xiao" v-show="xiao" @click="goback">&lt;</span>
    <p class="title" v-show="title">{{ title }}</p>
    <span class="iconfont" v-show="more">&#xe719;</span>
  </div>
</template>

<script>
import Search from './Search.vue'
export default {
  components: { Search },
  props: {
    // 控制搜索框的显示隐藏
    Searchval: {
      type: Boolean,
      default: false
    },
    // 控制编辑图标的显示隐藏
    Editval: {
      type: Boolean,
      default: false
    },
    // 控制字段的内容
    title: {
      type: String
    },
    titledi: {
      type: String
    },
    // 控制更多图标的显示隐藏
    more: {
      type: Boolean,
      default: false
    },
    // 控制小于号图标的显示隐藏
    xiao: {
      type: Boolean,
      default: false
    }
  },
  methods: {
    goback() {
      this.$emit('goback')
    }
  },
  created() {
    const title = document.querySelector('.title')
    console.log(title);
    title.style.marginRight = this.titledi
  }

}
</script>

<style lang="scss" scoped>
$width: 100%;

.box {
  background-color: #fff;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 10;
  width: 100%;
  height: 44px;
  line-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;

  .editicon {
    color: rgb(51, 51, 51);
  }

  .title {
    font-size: 16px;
    font-weight: 700;
    text-align: center !important;
  }

  .xiao {
    float: left;
  }
}
</style>